package com.project.webapp.action.front.preSchool;

import java.util.List;

import com.project.dao.bean.Goodplace;
import com.project.service.front.preSchool.GoodplaceService;
import com.project.webapp.action.BaseAction;

/**
 * 发布好去处 Action
 * @author Sn
 *
 */
public class GoodplaceAction extends BaseAction {

	/**
	 * 序列化版本号
	 */
	private static final long serialVersionUID = 1L;
	private String operateResult = "";
	private GoodplaceService goodplaceService;
	private Goodplace goodplace;
	List<Goodplace> goodplaceList;
	
	@Override
	public String execute() throws Exception 
	{
		goodplace = new Goodplace();
		if(goodplaceList!=null && goodplaceList.size()>0)
		{
			goodplaceList.clear();
		}
		return this.query();
	}
	
	public String showAdd() 
	{
		goodplace = new Goodplace();
        operateResult = "";
        return SUCCESS;
    }

    /**
     * 
     * <pre>
     * 查询
     * </pre>
     *
     * @return
     */
    public String query() 
    {

        return SUCCESS;
    }
    
    /**
     * 
     * <pre>
     * 保存
     * </pre>
     *
     * @return
     */
    public String save() 
    {
    	try 
    	{
    		goodplace.setArea(goodplace.getArea_s()+goodplace.getArea_e());
    		goodplaceService.save(goodplace);
    		operateResult = "suc";
    		
    	} catch (Exception e) 
    	{
    		e.printStackTrace();
    		operateResult = "fail";
    	}
    	goodplace = new Goodplace();
    	return "suc";
    }

	public String getOperateResult() {
		return operateResult;
	}

	public void setOperateResult(String operateResult) {
		this.operateResult = operateResult;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public GoodplaceService getGoodplaceService() {
		return goodplaceService;
	}

	public void setGoodplaceService(GoodplaceService goodplaceService) {
		this.goodplaceService = goodplaceService;
	}

	public Goodplace getGoodplace() {
		return goodplace;
	}

	public void setGoodplace(Goodplace goodplace) {
		this.goodplace = goodplace;
	}

	public List<Goodplace> getGoodplaceList() {
		return goodplaceList;
	}

	public void setGoodplaceList(List<Goodplace> goodplaceList) {
		this.goodplaceList = goodplaceList;
	}
    
}
